Imports System.Runtime.CompilerServices
Imports System.Data.Objects

Public Module IQueryableExtensions

    <Extension()>
    Public Function Include(Of TSource)(ByVal source As IQueryable(Of TSource), ByVal path As String) As IQueryable(Of TSource)
        Dim objectQuery = TryCast(source, ObjectQuery(Of TSource))
        If objectQuery IsNot Nothing Then
            Return objectQuery.Include(path)
        Else
            Return source
        End If
    End Function

End Module

